package com.utils;

import com.entity.Result;

public class ResultUtil {

    public static Result success(Object o){
        Result result = new Result();
        result.setCode(0);
        result.setMsg("成功");
        result.setData(o);
        return result;
    }
    public static Result success(){
        Result result = new Result();
        result.setCode(0);
        result.setMsg("成功");
        return result;
    }

    public static Result success(Object o,Long count){
        Result result = new Result();
        result.setCode(0);
        result.setMsg("成功");
        result.setData(o);
        result.setCount(count);
        return result;
    }

    public static Result success(String message,Object o,Long count){
        Result result = new Result();
        result.setCode(0);
        result.setMsg(message);
        result.setData(o);
        result.setCount(count);
        return result;
    }
    public  static Result error(String message){
        Result result = new Result();
        result.setCode(500);
        result.setMsg(message);
        return result;
    }

    public  static Result error(int code,String message){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(message);
        return result;
    }
}
